package model
{
	import com.adobe.cairngorm.model.IModelLocator;
	
	import model.tree.PlaceNode;
	import model.tree.TripNode;
	
	import mx.collections.ArrayCollection;
	
	import services.TestObjectGenerator;
	
	import valueObjects.VOTrip;
	import valueObjects.VOUser;
	
	import view.administrator.detail.TripView;
	
	[Bindable]
	public class Model implements IModelLocator
	{
		
		private static var _instance:Model;
		
		public function Model()
		{
			// initializing the my tripst
//			myTrips =  TestObjectGenerator.myTrips;
			myTrips = new ArrayCollection();
			searchedTrips = new ArrayCollection();
			_instance = this;
		}
		
		
		
		public static function get instance ():Model
		{
			if (_instance == null)
				_instance = new Model();
			
			return _instance;
		}
		
		
		/*******************************************
		 *  Attributes
		 *******************************************/
		public var isLoggedIn:Boolean = false;
		public var currentUser:VOUser;
		
		// current inspected node
		public var myTrips:ArrayCollection;
		public var searchedTrips:ArrayCollection;
		public var myPictures:ArrayCollection;
		public var placeComments:ArrayCollection;
		public var currentPlace:PlaceNode;
		public var currentTrip:TripNode;
		public var isOwnSelected:Boolean = false;
		
		public var question:ArrayCollection;
		// refresh counter used, to have a new refresh when it's necesary
		public var refreshCounter:int = 0;
		
		
		// state variables
		public var isMapSelection:Boolean = false;
		public var isFileUploadVisible:Boolean = false;
		
		
		// WEBSERVICES
		//public var weather_xml:XMLList;
		public var weather_xml:XML;
		public var eventful_xml:XMLList;
		public var hotwire_xml:XMLList;
		public var flicker_xml:Array;
		//public var flicker_xml:XMLList;
		
		
		// editor states
		public var tripViewState:String= TripView.DEFAULT;
		
		
	}
}